<!--
 * @Descripttion: 
 * @Author: liuYaoYu
 * @Date: 2021-12-17 10:42:46
 * @LastEditors: liuYaoYu
 * @LastEditTime: 2021-12-17 10:46:25
-->
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>12312321321312</li>
    </ul>
    <script>
        var li = document.createElement('li')
        var ul = document.querySelector('ul')
        ul.appendChild(li)// 添加到最后面
        var lis=document.createElement('li')
        ul.insertBefore(lis,ul.children[0])// 指定插入到那个前面 
    </script>
</body>
</html>